
/*
 * MainFrame.java
 *
 * Created on 26.03.2010, 13:37:10
 */

package rosedb.gui;


import com.explodingpixels.macwidgets.HudWidgetFactory;
import com.explodingpixels.macwidgets.HudWindow;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Image;
import java.io.IOException;
import java.util.logging.Level;
import javax.imageio.ImageIO;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;




import rosedb.control.Controller;
import rosedb.model.Logger;
import rosedb.model.Rose;

/**
 * Hauptfenster
 * @author riu
 */
public class MainFrame extends javax.swing.JFrame{

    private RosesImageList rosesList;
    private OneRoseImageList oneRoseList;
    private DiaPreviewPanel previewPanel;
    private Controller control;

    /** Creates new form MainFrame */
    public MainFrame() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
        super("Rosendatenbank "+Controller.VERSION);
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        try {
            Image icon = ImageIO.read(getClass().getResource("/rosedb/resources/icon.png"));
            setIconImage(icon);
        } catch (IOException ex) {

        }
        
        initComponents();


        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


        pl_Features.setBackground(getBackground());


        
        rosesList = (RosesImageList)imgl_roses;
        oneRoseList = (OneRoseImageList)imgl_pics;  
        previewPanel = (DiaPreviewPanel) img_preview;
        
        
        

        rosesList.setTitleColor(Color.white);
        
        rosesList.setText(null);
        oneRoseList.setSelectionColor(Color.yellow);
        oneRoseList.setHoverColor(Color.WHITE);
        rosesList.setSelectionColor(Color.ORANGE);
        rosesList.setHoverColor(Color.WHITE);
        
        repaint();
        
        noRoseMode();
        control = new Controller(this);
        rosesList.init(control);

        getFeaturePanel().setController(control);
    }

//    public void newRoseMode(){
//        pl_Features.setVisible(true);
//        img_preview.setVisible(true);
//        imgl_pics.setVisible(true);
//        btn_addImage.setVisible(true);
//        btn_removeImage.setVisible(true);
//    }


    public void viewRoseMode(){
        pl_Features.setVisible(true);
        img_preview.setVisible(true);
        imgl_pics.setVisible(true);
        btn_addImage.setVisible(true);
        btn_addImage.setEnabled(true);
        btn_removeImage.setVisible(true);
        btn_delRose.setEnabled(oneRoseList.getSelectedImageIndex()!=-1);

        //pack();
    }


    public void noRoseMode(){
        pl_Features.setVisible(false);
        img_preview.setVisible(false);
        imgl_pics.setVisible(false);
        btn_addImage.setVisible(false);
        btn_removeImage.setVisible(false);
        btn_delRose.setEnabled(false);
        previewPanel.simplePreview(-1);
        btn_editFeatures.setText("bearbeiten");
        
        //pack();
    }
    

    public RosesImageList getRosesImageList(){
        return rosesList;
    }


    public OneRoseImageList getOneRoseImageList(){
        return oneRoseList;
    }

    public DiaPreviewPanel getPreviewPanel(){
        return previewPanel;
    }

    public FeaturePanel getFeaturePanel(){
       return (FeaturePanel) pl_roseFeatures;
    }

    public JButton getBtnDelImage(){
        return btn_removeImage;
    }


    public JButton getBtnDelRose(){
        return btn_delRose;
    }


    public JButton getRemoveFeature(){
        return btn_removeFeature;
    }

    public JButton getEditFeatures(){
        return btn_editFeatures;
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        popupMenu1 = new java.awt.PopupMenu();
        pl_main = new javax.swing.JPanel();
        pl_Features = new javax.swing.JPanel();
        btn_addFeature = HudWidgetFactory.createHudButton("");
        scr_roseFeatures = new javax.swing.JScrollPane();
        pl_roseFeatures = new FeaturePanel(control, this, scr_roseFeatures);
        btn_removeFeature = HudWidgetFactory.createHudButton("");
        btn_editFeatures = HudWidgetFactory.createHudButton("");
        imgl_pics = new OneRoseImageList();
        btn_addImage = HudWidgetFactory.createHudButton("");
        btn_removeImage = HudWidgetFactory.createHudButton("");
        img_preview = new DiaPreviewPanel(this, "Blubb", 0, true);
        imgl_roses = new RosesImageList();
        btn_newRose = HudWidgetFactory.createHudButton("Button");
        btn_delRose = HudWidgetFactory.createHudButton("");
        txt_search = HudWidgetFactory.createHudTextField("");
        btn_newRose1 = HudWidgetFactory.createHudButton("");

        popupMenu1.setLabel("popupMenu1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(102, 102, 102));

        pl_main.setBackground(new java.awt.Color(102, 102, 102));

        pl_Features.setBackground(pl_main.getBackground());

        btn_addFeature.setText("+");
        btn_addFeature.setToolTipText("Roseneingenschaft hinzufügen");
        btn_addFeature.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_addFeatureActionPerformed(evt);
            }
        });

        scr_roseFeatures.setBackground(pl_main.getBackground());
        scr_roseFeatures.setBorder(null);
        scr_roseFeatures.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scr_roseFeatures.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        scr_roseFeatures.setDoubleBuffered(true);

        pl_roseFeatures.setBackground(pl_main.getBackground());
        pl_roseFeatures.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
            public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
                pl_roseFeaturesMouseWheelMoved(evt);
            }
        });

        org.jdesktop.layout.GroupLayout pl_roseFeaturesLayout = new org.jdesktop.layout.GroupLayout(pl_roseFeatures);
        pl_roseFeatures.setLayout(pl_roseFeaturesLayout);
        pl_roseFeaturesLayout.setHorizontalGroup(
            pl_roseFeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 585, Short.MAX_VALUE)
        );
        pl_roseFeaturesLayout.setVerticalGroup(
            pl_roseFeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 497, Short.MAX_VALUE)
        );

        scr_roseFeatures.setViewportView(pl_roseFeatures);

        btn_removeFeature.setText("-");
        btn_removeFeature.setToolTipText("Roseneigenschaft entfernen");
        btn_removeFeature.setEnabled(false);
        btn_removeFeature.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_removeFeatureActionPerformed(evt);
            }
        });

        btn_editFeatures.setText("bearbeiten");
        btn_editFeatures.setToolTipText("Roseneigenschaften bearbeiten");
        btn_editFeatures.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_editFeaturesActionPerformed(evt);
            }
        });

        imgl_pics.setBackground(pl_main.getBackground());
        imgl_pics.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        org.jdesktop.layout.GroupLayout imgl_picsLayout = new org.jdesktop.layout.GroupLayout(imgl_pics);
        imgl_pics.setLayout(imgl_picsLayout);
        imgl_picsLayout.setHorizontalGroup(
            imgl_picsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 127, Short.MAX_VALUE)
        );
        imgl_picsLayout.setVerticalGroup(
            imgl_picsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 473, Short.MAX_VALUE)
        );

        btn_addImage.setText("+");
        btn_addImage.setToolTipText("Bild hinzufügen");
        btn_addImage.setEnabled(false);
        btn_addImage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_addImageActionPerformed(evt);
            }
        });

        btn_removeImage.setText("-");
        btn_removeImage.setToolTipText("Bild entfernen");
        btn_removeImage.setEnabled(false);
        btn_removeImage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_removeImageActionPerformed(evt);
            }
        });

        img_preview.setBackground(pl_main.getBackground());
        img_preview.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        img_preview.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        org.jdesktop.layout.GroupLayout img_previewLayout = new org.jdesktop.layout.GroupLayout(img_preview);
        img_preview.setLayout(img_previewLayout);
        img_previewLayout.setHorizontalGroup(
            img_previewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 538, Short.MAX_VALUE)
        );
        img_previewLayout.setVerticalGroup(
            img_previewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 473, Short.MAX_VALUE)
        );

        org.jdesktop.layout.GroupLayout pl_FeaturesLayout = new org.jdesktop.layout.GroupLayout(pl_Features);
        pl_Features.setLayout(pl_FeaturesLayout);
        pl_FeaturesLayout.setHorizontalGroup(
            pl_FeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(pl_FeaturesLayout.createSequentialGroup()
                .add(pl_FeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(pl_FeaturesLayout.createSequentialGroup()
                        .add(btn_addFeature)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(btn_removeFeature)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(btn_editFeatures))
                    .add(scr_roseFeatures, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 411, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(pl_FeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(pl_FeaturesLayout.createSequentialGroup()
                        .add(btn_addImage)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(btn_removeImage))
                    .add(imgl_pics, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(img_preview, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pl_FeaturesLayout.setVerticalGroup(
            pl_FeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, pl_FeaturesLayout.createSequentialGroup()
                .add(pl_FeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(img_preview, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(scr_roseFeatures, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, imgl_pics, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(pl_FeaturesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btn_addFeature, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btn_removeFeature, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btn_editFeatures, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btn_addImage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btn_removeImage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
        );

        img_preview.getAccessibleContext().setAccessibleParent(pl_main);

        imgl_roses.setBackground(new java.awt.Color(51, 51, 51));
        imgl_roses.setToolTipText("Rosen");
        imgl_roses.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                imgl_rosesMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout imgl_rosesLayout = new org.jdesktop.layout.GroupLayout(imgl_roses);
        imgl_roses.setLayout(imgl_rosesLayout);
        imgl_rosesLayout.setHorizontalGroup(
            imgl_rosesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1134, Short.MAX_VALUE)
        );
        imgl_rosesLayout.setVerticalGroup(
            imgl_rosesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 96, Short.MAX_VALUE)
        );

        btn_newRose.setText("+");
        btn_newRose.setToolTipText("Neue Rose");
        btn_newRose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_newRoseActionPerformed(evt);
            }
        });

        btn_delRose.setText("-");
        btn_delRose.setToolTipText("Rose löschen");
        btn_delRose.setEnabled(false);
        btn_delRose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_delRoseActionPerformed(evt);
            }
        });

        txt_search.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txt_searchCaretUpdate(evt);
            }
        });
        txt_search.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                txt_searchInputMethodTextChanged(evt);
            }
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
                txt_searchCaretPositionChanged(evt);
            }
        });

        btn_newRose1.setText("?");
        btn_newRose1.setToolTipText("Info");
        btn_newRose1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_newRose1ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout pl_mainLayout = new org.jdesktop.layout.GroupLayout(pl_main);
        pl_main.setLayout(pl_mainLayout);
        pl_mainLayout.setHorizontalGroup(
            pl_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, pl_mainLayout.createSequentialGroup()
                .addContainerGap()
                .add(pl_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(pl_mainLayout.createSequentialGroup()
                        .add(btn_newRose, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(btn_delRose, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(btn_newRose1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 763, Short.MAX_VALUE)
                        .add(txt_search, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 197, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(pl_Features, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(imgl_roses, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        pl_mainLayout.setVerticalGroup(
            pl_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, pl_mainLayout.createSequentialGroup()
                .addContainerGap()
                .add(pl_mainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btn_delRose)
                    .add(btn_newRose)
                    .add(txt_search, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btn_newRose1))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(imgl_roses, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(pl_Features, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(pl_main, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, pl_main, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btn_newRoseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_newRoseActionPerformed
        AddRoseDialog ard = new AddRoseDialog("Name der neuen Rose:", this);
        String name = ard.getName();
        //String name = JOptionPane.showInputDialog(this, "Name der neuen Rose:");
        if(name!=null && !name.trim().equals("")){
            Rose r = new Rose(name);
            while(name!=null && rosesList.containsReferenz(r)){
                //name = JOptionPane.showInputDialog(this, "Diesen Namen hat schon eine andere Rose!\nName der neuen Rose:");
                ard.dispose();
                ard = new AddRoseDialog("Diesen Namen hat schon eine andere Rose:", this);
                name = ard.getName();
                r = new Rose(name);
            }
            
            if(name!=null){
                control.loadRose(r);
                control.updateRose();
                try{
                    rosesList.addRose(r);
                }catch(Exception e){
                    rosedb.model.Logger.log(e);
                }
            }
        }

        if(!ard.isDisposed()){
            ard.dispose();
        }
    }//GEN-LAST:event_btn_newRoseActionPerformed

    private void btn_delRoseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_delRoseActionPerformed
        //if(JOptionPane.showConfirmDialog(this, "Wollen Sie die Rose "+control.getCurrentRose().getName()+" wirklich löschen?", "Rose löschen", JOptionPane.YES_NO_OPTION)== JOptionPane.YES_OPTION){
        DeleteRoseDialog drd = new DeleteRoseDialog(control.getCurrentRose().getName(), this);
        DeleteRoseDialog.Answer answer = drd.getAnswer();
        if(answer == DeleteRoseDialog.Answer.YES){
            control.deleteRose();
        }
    }//GEN-LAST:event_btn_delRoseActionPerformed

    private void btn_addImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addImageActionPerformed
        control.loadImagesForRose();
    }//GEN-LAST:event_btn_addImageActionPerformed

    private void btn_removeImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_removeImageActionPerformed
        control.deleteImage(oneRoseList.getSelectedImageIndex());
    }//GEN-LAST:event_btn_removeImageActionPerformed

    private void imgl_rosesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imgl_rosesMouseClicked
        if(evt.getClickCount()>=2 && rosesList.getSelectedImageIndex()==-1){
            control.unloadRose();
        }
    }//GEN-LAST:event_imgl_rosesMouseClicked

    private void btn_editFeaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_editFeaturesActionPerformed
        
        ((FeaturePanel)pl_roseFeatures).editMode(!((FeaturePanel)pl_roseFeatures).isInEditMode());
    }//GEN-LAST:event_btn_editFeaturesActionPerformed

    private void pl_roseFeaturesMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_pl_roseFeaturesMouseWheelMoved
        //scr_roseFeatures
    }//GEN-LAST:event_pl_roseFeaturesMouseWheelMoved

    private void btn_addFeatureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addFeatureActionPerformed
        ((FeaturePanel)pl_roseFeatures).editMode(false);
        getFeaturePanel().addFeature();
    }//GEN-LAST:event_btn_addFeatureActionPerformed

    private void btn_removeFeatureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_removeFeatureActionPerformed
        getFeaturePanel().removeFeature();
    }//GEN-LAST:event_btn_removeFeatureActionPerformed

    private void btn_newRose1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_newRose1ActionPerformed
        //new AboutDialog(this, true).setVisible(true);
        HudWindow hud = new HudWindow("Rosendatenbank "+Controller.VERSION, this);
        hud.getJDialog().setSize(477, 200);
        hud.getJDialog().setLocationRelativeTo(this);
        hud.getJDialog().setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        hud.setContentPane(new AboutPanel());
        hud.getJDialog().setModal(true);
        hud.getJDialog().setVisible(true);
    }//GEN-LAST:event_btn_newRose1ActionPerformed

    private void txt_searchCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txt_searchCaretUpdate
        control.updateSearch(txt_search.getText().trim());
    }//GEN-LAST:event_txt_searchCaretUpdate

    private void txt_searchInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_txt_searchInputMethodTextChanged
        
    }//GEN-LAST:event_txt_searchInputMethodTextChanged

    private void txt_searchCaretPositionChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_txt_searchCaretPositionChanged
        
    }//GEN-LAST:event_txt_searchCaretPositionChanged

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               
                    try {
                        new MainFrame().setVisible(true);
                    } catch (ClassNotFoundException ex) {
                        Logger.log(ex);
                    } catch (InstantiationException ex) {
                        Logger.log(ex);
                    } catch (IllegalAccessException ex) {
                        Logger.log(ex);
                    } catch (UnsupportedLookAndFeelException ex) {
                        Logger.log(ex);
                    }
                
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_addFeature;
    private javax.swing.JButton btn_addImage;
    private javax.swing.JButton btn_delRose;
    private javax.swing.JButton btn_editFeatures;
    private javax.swing.JButton btn_newRose;
    private javax.swing.JButton btn_newRose1;
    private javax.swing.JButton btn_removeFeature;
    private javax.swing.JButton btn_removeImage;
    private javax.swing.JPanel img_preview;
    private javax.swing.JPanel imgl_pics;
    private javax.swing.JPanel imgl_roses;
    private javax.swing.JPanel pl_Features;
    private javax.swing.JPanel pl_main;
    private javax.swing.JPanel pl_roseFeatures;
    private java.awt.PopupMenu popupMenu1;
    private javax.swing.JScrollPane scr_roseFeatures;
    private javax.swing.JTextField txt_search;
    // End of variables declaration//GEN-END:variables

   

    

}
